import { IFeidaoAiWeappPage } from '@dfeidao/atom-wxapp/interfaces';
import get_local from '@dfeidao/atom-wxapp/local/get';
import execute from '@dfeidao/atom-wxapp/msg/execute';
import show_modal from '@dfeidao/atom-wxapp/api/interaction/show-modal';
import get_global from '@dfeidao/atom-wxapp/global/get';
import showloading from '@dfeidao/atom-wxapp/api/interaction/show-loading';
import hideLoadling from '@dfeidao/atom-wxapp/api/interaction/hide-loading';

import { spaceid, systemid } from '../atom/config';

export default async function a006(fd: IFeidaoAiWeappPage) {
	const doccode = get_local(fd, 'doccode')
	showloading('过账中')

	const userInfo = get_global('userinfo') as any;
	try {
		await execute('self_sell-modelsupplement_order-0001_2.1', {
			param: {
				doccode,
				stepno: "100",
				pageno: "outbound",
				root_table: "supplement_order"
			}
		}, userInfo.usercode, spaceid, systemid, 0)
		// console.log('11111111111')
		// debugger
		// a007(fd)
	} catch (error) {
		const succ = await show_modal('过账失败', error.errMsg.toString());
		if (succ.msg.confirm) {
			console.log('用户点击确定')
		} else if (succ.msg.cancel) {
			console.log('用户点击取消')
		}
		hideLoadling();
	}
}
